<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Taskflow Handbook</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="https://taskflow.github.io/">Taskflow</a>
   &#160;<span id="projectnumber">3.0.0-Master-Branch</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('index.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Quick Start </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="ModernCppParallelTaskProgrammingLibrary"></a>
Modern C++ Parallel Task Programming</h1>
<p>Taskflow helps you quickly write parallel task programs with high performance scalability and simultaneous high productivity. It is faster, more expressive, fewer lines of code, and easier for drop-in integration than many of existing task programming frameworks.</p>
<div class="image">
<img src="performance.png" alt="performance.png" width="100%"/>
</div>
<p>Taskflow is committed to support both academic and industry research projects, making it reliable and cost-efficient to develop large-scale parallel applications. Our users say:</p>
<ul>
<li>"<em>Taskflow has the cleanest task API I've ever seen.</em>" <a href="http://coreliuminc.com">Damien Hocking @Corelium Inc</a> </li>
<li>"<em>Taskflow has a very simple and elegant tasking interface. The performance also scales very well.</em>" <a href="https://github.com/totalgee">Glen Fraser</a> </li>
<li>"<em>Taskflow lets me handle parallel processing in a smart way.</em>" <a href="https://cpp-learning.com/cpp-taskflow/">Hayabusa @Learning</a> </li>
<li>"<em>Taskflow helps improve the throughput of our graph processing engine in just a few hours of coding.</em>" <a href="https://ossia.io/">Jean-Michaël @KDAB</a> </li>
<li>"<em>Best poster award for the open-source parallel programming library.</em>" <a href="https://github.com/CppCon/CppCon2018">2018 Cpp Conference</a> </li>
<li>"<em>Second Place in Open Source Software Competition.</em>" 2019 ACM Multimedia Conference</li>
</ul>
<p>See a quick <a href="https://taskflow.github.io/">presentation</a> and visit our <a href="https://github.com/taskflow/taskflow">GitHub</a> to learn more about Taskflow.</p>
<h1><a class="anchor" id="StaticDynamicTasking"></a>
Static and Dynamic Tasking</h1>
<p>Taskflow has a unified interface for both <em>static</em> tasking and <em>dynamic</em> tasking, allowing users to quickly master our parallel task programming model in a natural idiom.</p>
<table width="100%">
<tr>
<td align="center">Static Tasking </td><td align="center">Dynamic Tasking  </td></tr>
<tr>
<td><div class="image">
<object type="image/svg+xml" data="static_graph.svg" width="100%</td>">static_graph.svg</object>
</div>
 </td><td><div class="image">
<object type="image/svg+xml" data="dynamic_graph.svg" width="100%</td>">dynamic_graph.svg</object>
</div>
  </td></tr>
</table>
<h1><a class="anchor" id="ConditionalTasking"></a>
Conditional Tasking</h1>
<p>Taskflow supports conditional tasking for you to implement cyclic and dynamic control flows that are otherwise difficult to do with existing task programming frameworks.</p>
<div class="image">
<object type="image/svg+xml" data="condition.svg" width="100%">condition.svg</object>
</div>
<h1><a class="anchor" id="ComposableTasking"></a>
Composable Tasking</h1>
<p>Taskflow is composable. You can create large parallel graphs through composition of modular and reusable blocks that are easier to optimize at an individual scope.</p>
<div class="image">
<object type="image/svg+xml" data="framework.svg" width="100%">framework.svg</object>
</div>
<h1><a class="anchor" id="HeterogeneousTasking"></a>
Concurrent CPU-GPU Tasking</h1>
<p>Taskflow supports heterogeneous tasking for you to accelerate a wide range of scientific computing applications by harnessing the power of CPU-GPU collaborative computing.</p>
<div class="image">
<object type="image/svg+xml" data="cudaflow.svg" width="100%">cudaflow.svg</object>
</div>
<p>Taskflow provides visualization and tooling (<a href="https://github.com/taskflow/tfprof">tfprof</a>) needed for profiling Taskflow programs.</p>
<div class="image">
<img src="tfprof.png" alt="tfprof.png" width="100%"/>
</div>
<h1><a class="anchor" id="HowToInstallCppTaskflow"></a>
How to Install Taskflow?</h1>
<p>Taskflow is <em>header-only</em> and there is no need for installation. Simply download the source and copy the headers under the directory <code>taskflow/</code> to your project.</p>
<div class="fragment"><div class="line">~$ git clone https://github.com/taskflow/taskflow.git</div><div class="line">~$ cd taskflow/</div><div class="line">~$ cp -r taskflow myproject/include/</div></div><!-- fragment --><h1><a class="anchor" id="ASimpleFirstProgram"></a>
A Simple First Program</h1>
<p>Here is a rather simple program to get you started.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="taskflow_8hpp.html">taskflow/taskflow.hpp</a>&gt;</span>  <span class="comment">// Taskflow is header-only</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(){</div><div class="line">  </div><div class="line">  <a class="code" href="classtf_1_1Executor.html">tf::Executor</a> executor;</div><div class="line">  <a class="code" href="classtf_1_1Taskflow.html">tf::Taskflow</a> taskflow;</div><div class="line"></div><div class="line">  <span class="keyword">auto</span> [A, B, C, D] = taskflow.<a class="code" href="classtf_1_1FlowBuilder.html#a60d7a666cab71ecfa3010b2efb0d6b57">emplace</a>(</div><div class="line">    [] () { <a class="codeRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;TaskA\n&quot;</span>; },   <span class="comment">//  task dependency graph</span></div><div class="line">    [] () { <a class="codeRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;TaskB\n&quot;</span>; },   <span class="comment">// </span></div><div class="line">    [] () { <a class="codeRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;TaskC\n&quot;</span>; },   <span class="comment">//          +---+          </span></div><div class="line">    [] () { <a class="codeRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;TaskD\n&quot;</span>; }    <span class="comment">//    +----&gt;| B |-----+   </span></div><div class="line">  );                                     <span class="comment">//    |     +---+     |</span></div><div class="line">                                         <span class="comment">//  +---+           +-v-+ </span></div><div class="line">  A.<a class="code" href="classtf_1_1Task.html#a8c78c453295a553c1c016e4062da8588">precede</a>(B);  <span class="comment">// A runs before B      //  | A |           | D | </span></div><div class="line">  A.<a class="code" href="classtf_1_1Task.html#a8c78c453295a553c1c016e4062da8588">precede</a>(C);  <span class="comment">// A runs before C      //  +---+           +-^-+ </span></div><div class="line">  B.<a class="code" href="classtf_1_1Task.html#a8c78c453295a553c1c016e4062da8588">precede</a>(D);  <span class="comment">// B runs before D      //    |     +---+     |    </span></div><div class="line">  C.<a class="code" href="classtf_1_1Task.html#a8c78c453295a553c1c016e4062da8588">precede</a>(D);  <span class="comment">// C runs before D      //    +----&gt;| C |-----+    </span></div><div class="line">                                         <span class="comment">//          +---+          </span></div><div class="line">  executor.<a class="code" href="classtf_1_1Executor.html#a81f35d5b0a20ac0646447eb80d97c0aa">run</a>(taskflow).wait();</div><div class="line"></div><div class="line">  <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --><p>The program creates four tasks A, B, C, and D. The dependency constraints force A to run before B and C, and D to run after B and C. The maximum concurrency is this example is two, where B and C can run at the same time.</p>
<div class="image">
<object type="image/svg+xml" data="simple.svg" width="35%">simple.svg</object>
</div>
<h1><a class="anchor" id="CompileAndRunYourFirstProgram"></a>
Compile and Run Your First Program</h1>
<p>Taskflow is written in C++17 and is built on top of C++ standardized threading libraries. To compile the above program, you need to tell the compiler where to find the Taskflow header files. For example, with gcc you need the <code>-I</code> option.</p>
<div class="fragment"><div class="line">~$ g++ -std=c++17 simple.cpp -I myproject/include/ -O2 -pthread -o simple</div><div class="line">~$ ./simple</div><div class="line">TaskA</div><div class="line">TaskC </div><div class="line">TaskB </div><div class="line">TaskD</div></div><!-- fragment --><p>The execution order of B and C might differ as they can run concurrently.</p>
<h1><a class="anchor" id="SupportedCompilers"></a>
Supported Compilers</h1>
<p>To use Taskflow, you only need a compiler that supports C++17:</p>
<ul>
<li>GNU C++ Compiler at least v7.0 with -std=c++17 </li>
<li>Clang C++ Compiler at least v6.0 with -std=c++17 </li>
<li>Microsoft Visual Studio at least v15.7 (MSVC++ 19.14) </li>
<li>AppleClang Xode Version at least v12.0 with -std=c++17 </li>
<li>Nvidia CUDA Toolkit and Compiler (nvcc) at least v11.1 with -std=c++17</li>
</ul>
<p>Taskflow works on Linux, Windows, and Mac OS X.</p>
<h1><a class="anchor" id="License"></a>
License</h1>
<p>Taskflow is open-source under permissive MIT license. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
